package com.ruoyi.consumer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumer.mapper.CWalletPersonMapper;
import com.ruoyi.consumer.domain.CWalletPerson;
import com.ruoyi.consumer.service.ICWalletPersonService;

/**
 * 个人钱包Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-29
 */
@Service
public class CWalletPersonServiceImpl implements ICWalletPersonService 
{
    @Autowired
    private CWalletPersonMapper cWalletPersonMapper;

    /**
     * 查询个人钱包
     * 
     * @param userId 个人钱包主键
     * @return 个人钱包
     */
    @Override
    public CWalletPerson selectCWalletPersonByUserId(Integer userId)
    {
        return cWalletPersonMapper.selectCWalletPersonByUserId(userId);
    }

    /**
     * 查询个人钱包列表
     * 
     * @param cWalletPerson 个人钱包
     * @return 个人钱包
     */
    @Override
    public List<CWalletPerson> selectCWalletPersonList(CWalletPerson cWalletPerson)
    {
        return cWalletPersonMapper.selectCWalletPersonList(cWalletPerson);
    }

    /**
     * 新增个人钱包
     * 
     * @param cWalletPerson 个人钱包
     * @return 结果
     */
    @Override
    public int insertCWalletPerson(CWalletPerson cWalletPerson)
    {
        cWalletPerson.setCreateTime(DateUtils.getNowDate());
        return cWalletPersonMapper.insertCWalletPerson(cWalletPerson);
    }

    /**
     * 修改个人钱包
     * 
     * @param cWalletPerson 个人钱包
     * @return 结果
     */
    @Override
    public int updateCWalletPerson(CWalletPerson cWalletPerson)
    {
        cWalletPerson.setUpdateTime(DateUtils.getNowDate());
        return cWalletPersonMapper.updateCWalletPerson(cWalletPerson);
    }

    /**
     * 批量删除个人钱包
     * 
     * @param userIds 需要删除的个人钱包主键
     * @return 结果
     */
    @Override
    public int deleteCWalletPersonByUserIds(Integer[] userIds)
    {
        return cWalletPersonMapper.deleteCWalletPersonByUserIds(userIds);
    }

    /**
     * 删除个人钱包信息
     * 
     * @param userId 个人钱包主键
     * @return 结果
     */
    @Override
    public int deleteCWalletPersonByUserId(Integer userId)
    {
        return cWalletPersonMapper.deleteCWalletPersonByUserId(userId);
    }
}
